# -*- coding: utf-8; -*-

import codecs
import locale
from optparse import OptionParser
import sys

import wx

import mainwindow
import model
import config

# Replace stderr with an encoding-aware version.
sys.stderr = codecs.getwriter(locale.getpreferredencoding())(sys.stderr)

opt = OptionParser('usage: %prog [OPTIONS]')
opt.add_option('-d', '--config-dir', dest='config_dir', default=None,
               metavar='DIRECTORY',
               help='use DIRECTORY for storing configuration')
options, args = opt.parse_args()

graph_mgr = model.SiocGraphMgr()
config_mgr = config.ConfigMgr(graph_mgr, options.config_dir)

app = wx.App()
window = mainwindow.MainWindow(graph_mgr, config_mgr)
app.MainLoop()
